<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8"/>
    <meta name="description" content="A easy, small, straight forward Java CRUD Helper"/>
    <meta name="keywords" content="SqlMan, document, java sql, java jdbc, java orm, jdbc tools, jdbc helper"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
    <script src="https://g.alicdn.com/code/lib/vue/2.7.16/vue.min.js"></script>
    <link rel="stylesheet" href="https://framework.ajaxjs.com/static/font/font.css"/>
    <link rel="stylesheet" href="/style/index.css"/>
    <link rel="icon" type="image/png" href="/asset/favicon.png"/>
    <script src="/asset/js/website.js"></script>

    <link rel="stylesheet" href="/style/common.css"/>
    <link rel="stylesheet" href="/style/blog.css"/>
    <title>SqlMan's Blog: The XML Template Engine</title>
</head>

<body class="blog">
<header class="top">
    <a class="github-fork-ribbon" href="https://github.com/lightweight-component/SqlMan" data-ribbon="Fork me on GitHub"
       title="Fork me on GitHub">Fork me on GitHub</a>
    <div>
        <nav>

            <div id="tools">
                <div class="locales-btn" onmousemove="document.querySelector('#tools menu').classList.add('show')"
                     onmouseleave="document.querySelector('#tools menu').classList.remove('show')">
                    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" style="max-width: 42px;">
                        <path d="M0 0h24v24H0z" fill="none"></path>
                        <path
                                d=" M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z "
                                class="css-c4d79v"></path>
                    </svg>
                    <menu onmousemove="document.querySelector('#tools menu').classList.add('show')"
                          onmouseleave="document.querySelector('#tools menu').classList.remove('show')">
                        <ul>
                            <li><a href="https://sqlman.ajaxjs.com">English »</a></li>
                            <li><a href="https://sqlman.ajaxjs.com/cn-s">简体中文 »</a></li>
                            <li><a href="https://sqlman.ajaxjs.com/cn">正体中文 »</a></li>
                        </ul>
                    </menu>
                </div>
                <my-switch v-model="isDark"></my-switch>
            </div>
            <ul>
                <li><a href="/index.html">Home</a></li>
                <li><a href="/docs">Documents</a></li>
                <li><a href="/blog">Blog</a></li>
                <li><a href="https://github.com/lightweight-component/SqlMan" target="_blank">SourceCode</a></li>
            </ul>

        </nav>

        <div class="img">
            <img id="main-img" src="/asset/img.jpg" width="500" alt=""/>
            <div>This has nothing to do with the "Dragon Ball";<br/> I just happen to be a fan of this comic.</div>
        </div>
        <div class="text">
            <h1>Welcome to SqlMan!</h1>
            <h2>A easy, small, straight forward Java CRUD Helper.</h2>
            <p>SqlMan is a lightweight wrapper over JDBC. It is NOT an ORM but follows a SQL-first approach. It allows
                you
                to use pure SQL with IF/forEach and pass Map parameters for queries or executions. The results you
                receive
                are either 'isOk' indicators and 'Map' or Java Bean object(s). SqlMan enables fast CRUD database
                operations
                with ZERO dependencies, except for the JDK.
            </p>

            <br/>
            <br/>
            <p>Similar libraries：Spring JDBC Template, Apache Commons DbUtils, Jdbi3.</p>

            <br/>
            <br/>
            <button class="primary" onclick="location.assign('/docs/quick-start')">Getting Start</button>
            <button onclick="window.open('https://github.com/lightweight-component/SqlMan')">Git Code</button>
        </div>

    </div>
</header>
<div class="content main">
    <h1>
        Blog
    </h1>
    <div class="list article">
        <h1>The XML Template Engine</h1>
        <h2>2024-12-25 by Frank Cheung</h2>
        <h1>The XML Template Engine</h1>
        <p>I need to template to do the jobs like MyBatis <code>&lt;if&gt;&lt;else&gt;&lt;foreach&gt;</code>. However, it's not easy to achieve it.
            MyBatis is using own XML parser with OGNL expression engine, details <a href="https://www.cnblogs.com/fangjian0423/p/mybaits-dynamic-sql-analysis.html">here</a>.</p>
        <p>It's hard to copy that.</p>
        <p>Another way is to use the common template engine, like Thymeleaf/Freemarker, but it's too heavy I think.</p>
        <p><a href="http://ibeetl.com/">Beetl</a> is a sharp project, better than Java HTML template engines, and it mentions the library ANTLR like a compiler.</p>
        <p>It's a advanced topic, I don't think I can handle it well.</p>
        <p>However, I'm considering to put this problem on other hand, This is a question about how to implement your own DSL.</p>
        <p>At this point, <a href="https://github.com/pfmiles/dropincc.java">dropincc.java</a>, a small parser generator, comes into my eyes, and the author says,
            it ships with a <a href="http://pfmiles.github.io/blog/what-does-a-template-engine-for-code-generation-look-like/">template engine</a>
            that can be used to generatetemplate engine, which is exactly what I need. But I can't find its implementation in the project!</p>
        <p>So, The ANTLR's <a href="https://www.jianshu.com/p/d87ef30a2f63">StringTemplate</a> is the best choice. StringTemplate seems to be the only choice.</p>

    </div>
</div>

<footer>
    SqlMan, a part of <a href="https://framework.ajaxjs.com" target="_blank">AJ-Framework</a> open source. Mail:
    frank@ajaxjs.com, visit <a href="https://blog.csdn.net/zhangxin09" target="_blank">my blog(In Chinese)</a>.
    <br/>
    <br/>
    Copyright © 2025 Frank Cheung. All rights reserved.
    <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?3cb62106ad945fc91efddfe250e1542e";
          var s = document.getElementsByTagName("script")[0];
          s.parentNode.insertBefore(hm, s);
        })();

    </script>
</footer>
</body>

</html>